﻿@using NewsMine.DomainObjects;
@{
    
    ViewBag.Title = "Look at news";
    // Layout = "~/Views/Shared/_Layout.cshtml";

    QResult DataFromController = (QResult)Model;
    string previousPageLink = DataFromController.CurrentUrl + "&pgno=" + (DataFromController.PageNumber - 1).ToString();
    string nextPageLink = DataFromController.CurrentUrl + "&pgno=" + (DataFromController.PageNumber + 1).ToString();


    Layout = "~/Views/Shared/_3ColumnMasterLayout.cshtml";
    
}
<script src="@Url.Content("~/scripts/blocksit.js")"></script>
<script>

    window.setInterval(yourfunction, 10000);

    function yourfunction() { $(window).resize(); }

    $(document).ready(function () {

        $('#container').BlocksIt({
            numOfCol: 3,
            offsetX: 10,
            offsetY: 10
        });

        $('#websiteContainer').BlocksIt({
            numOfCol: 5,
            offsetX: 10,
            offsetY: 10
        });

        $("#container").width = $(window).width();
        $('#websiteContainer').width = $(window).width();
        $(window).resize();

        //blocksit define
        $(window).load(function () {

            $("#container").width = $(window).width();
            $('#websiteContainer').width = $(window).width();
            $(window).resize();

            $('#container').BlocksIt({
                numOfCol: 3,
                offsetX: 10,
                offsetY: 10
            });

            $('#websiteContainer').BlocksIt({
                numOfCol: 5,
                offsetX: 10,
                offsetY: 10
            });



        });

        //window resize
        var currentWidth = $(window).width();

        $(window).resize(function () {

            $('#websiteContainer').width = $(window).width();
            $('#websiteContainer').BlocksIt({
                numOfCol: 5,
                offsetX: 10,
                offsetY: 10
            });

            var winWidth = $(window).width();
            var conWidth;
            if (winWidth < 660) {
                conWidth = 440;
                col = 2
            } else if (winWidth < 880) {
                conWidth = 440;
                col = 2;
            } else if (winWidth < 1000) {
                conWidth = 880;
                col = 3;
            } else if (winWidth < 1100) {
                conWidth = 880;
                col = 3;
            }
            else if (winWidth > 1100) {
                conWidth = 1100;
                col = 3;
            }
            else {
                conWidth = 1100;
                col = 3;
            }

            if (conWidth != currentWidth) {
                currentWidth = conWidth;
                $('#container').width(conWidth);
                $('#container').BlocksIt({
                    numOfCol: col,
                    offsetX: 10,
                    offsetY: 10
                });
            }
        });
    });

    function rearrage() {
        var winWidth = $(window).width();
        var conWidth;
        if (winWidth < 660) {
            conWidth = 440;
            col = 2
        } else if (winWidth < 880) {
            conWidth = 440;
            col = 2;
        } else if (winWidth < 1000) {
            conWidth = 880;
            col = 3;
        } else if (winWidth < 1100) {
            conWidth = 880;
            col = 3;
        }
        else if (winWidth > 1100) {
            conWidth = 1100;
            col = 4;
        }
        else {
            conWidth = 1100;
            col = 4;
        }

        if (conWidth != currentWidth) {
            currentWidth = conWidth;
            $('#container').width(conWidth);
            $('#container').BlocksIt({
                numOfCol: col,
                offsetX: 10,
                offsetY: 10
            });
        }
    }

</script>
<body>
    <!-- Header -->
    @*<header id="header">
	<h1>Look at News</h1>
	<div id="backlinks">
		<a href="../">Back to Home Page &raquo;</a>
	</div>
	<div class="clearfix"></div>
</header>*@
    <!-- Content -->
    <section id="wrapper">
  <div class="pagination pagination-centered pagination-large">
 <ul>
                        <li><a href="@previousPageLink">&larr; Previous</a> </li>
                        <li><a href="@nextPageLink">Next &rarr;</a> </li>
                    </ul>
                    </div>

                    

<div id="container" style="background-color:#fbfbfb;">

@{
    List<FeedItem> feeds = ((QResult)Model).FeedItems;


    string webSiteIconUrl = "https://plus.google.com/_/favicon?alt=feed&domain=eenj.net";
    
    
    <div class="grid">
    <h2>News Sources</h2>
    <ul class="menu">
    @{
                
        List<NewsMine.DomainObjects.WebSiteInfo> websites = new List<NewsMine.DomainObjects.WebSiteInfo>();

        websites = ((QResult)Model).Websites;



        foreach (var website in websites)
        {
            <li>
            <h3>
        <a class='btn-link' style="margin:5px;padding-right:5px;" href="?domain=@website.Domain" >
                        <img src='https://plus.google.com/_/favicon?alt=feed&domain=@website.Domain ' style="padding-right:8px;width:20px;"/>@Html.Raw(website.Name)
                    </a>
               </h3>   
               </li>  
        }
               
                
                    
            }

            </ul>
    
    </div>
    
    
     if (feeds == null || feeds.Count == 0)
     {
         
        <div class="grid">
            <h2>Feed not found for the selected criteria.</h2>
            </div>
     }

     for (int i = 0; i < feeds.Count; i++)
     {

       
        
        <div class="grid">
        
        @if (!string.IsNullOrEmpty(feeds[i].category))
        {
        <a href="search?id=category:@feeds[i].category.Trim(',')">@feeds[i].category.Trim(',')</a>
        }
        
        
        @*@for (int count = 0; count < feeds[i].Tags.Count; count++)
        {
        <a href="search?id=tags:@feeds[i].Tags[count]">@feeds[i].Tags[count]</a>
        }*@

        
        @if (!string.IsNullOrEmpty(feeds[i].ImageUrl))
        {

		<div class="imgholder" style="text-align:center">
			<img style="border-radius:25px;min-width:200px;min-height:100px;max-height:200px;margin-left:auto;margin-right: auto;"  src="@feeds[i].ImageUrl" />
			@*<img style="border-radius:25px;min-width:200px;min-height:100px;max-height:200px;margin-left:auto;margin-right: auto;"  src="@Url.Content("~/content/img/white.gif")" data-original="@feeds[i].ImageUrl" />*@
			
            
		</div>
		
        <hr />
        }
        
        <a class="name" style="text-decoration: none;" target="_blank" href="@feeds[i].Link">
        <div style="overflow: hidden; line-height: 1.6; height: auto;padding:10px;font-size:25px; color: #000;text-align: left;">
        @Html.Raw(feeds[i].Title)</div>
        </a>
        <hr />
		
        <p>@feeds[i].category</p>

		<div class="meta">
        <img src="https://plus.google.com/_/favicon?alt=feed&amp;domain=@feeds[i].Domain " alt="@feeds[i].Domain"/>
                                                <span>by @feeds[i].Domain</span>
        </div>
	</div>
        
     }

        }


       
	
</div>

   <div class="pagination pagination-centered pagination-large">
 <ul>
                        <li><a href="@previousPageLink">&larr; Previous</a> </li>
                        <li><a href="@nextPageLink">Next &rarr;</a> </li>
                    </ul>
                    </div>

                    

<hr />

 <div id="websiteContainer" style="width: 1100px;position:relative;margin:0 auto 25px;background-color:#F0F0F0;border-top:#000;">
    
      @{
                
          List<NewsMine.DomainObjects.WebSiteInfo> websites1 = new List<NewsMine.DomainObjects.WebSiteInfo>();

          websites1 = ((QResult)Model).Websites;

          foreach (var website in websites1)
          {

              if (!string.IsNullOrEmpty(website.Logo1Uri))
              {
             
                <div class="grid" style="border-radius:25px;text-align:center;position:relative;border:1px solid lightgrey;">
		        
                <p>@website.Language</p>

                      <a class="name" style="text-decoration: none;text-align:center;left:50%;top:50%;" target="_self" href="?domain=@website.Domain">

			        <img style="max-width:100px;max-height:100px;margin-left:auto;margin-right: auto;"  src="@website.Logo1Uri" />
                       <h5> @Html.Raw(website.Name) </h5>      
                
                </a>
              </div>

              }

          }

       }

    </div>


</section>
    <!-- Footer -->
    <footer id="footer" style="display: none;">
	<span>&copy; 2012 <a href="#">lookatnews.com</a>. Design by <a href="#contact">Surendra</a></span>
</footer>
</body>
</html> 